/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package creditcardapp.model;

import creditcardapp.controller.AddCreditCardAccountController;
import creditcardapp.controller.GenerateMonthlyBillsController;
import creditcardapp.view.AddCreditCardDialog;
import creditcardapp.view.CreditCardTableModel;
import creditcardapp.view.CreditCardTopPanel;
import framework.controller.IController;
import framework.controller.WithdrawController;
import framework.model.Account;
import framework.model.Constant;
import framework.model.Customer;
import framework.model.Factory;
import framework.view.OperationPanel;
import framework.view.TopPanel;
import java.util.HashMap;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author LD
 */
public class CreditCardFactory extends Factory {

    @Override
    public Account createAccount(Customer cust, HashMap<String, String> fields) {
        switch (fields.get(Constant.CC_ACCOUNT_TYPE)) {
            case Constant.CC_TYPE_GOLD:
                return new Gold(cust, fields.get(Constant.CC_NUMBER), fields.get(Constant.CC_EXPIRED_DATE));
            case Constant.CC_TYPE_SILVER:
                return new Silver(cust, fields.get(Constant.CC_NUMBER), fields.get(Constant.CC_EXPIRED_DATE));
            default:
                return new Bronze(cust, fields.get(Constant.CC_NUMBER), fields.get(Constant.CC_EXPIRED_DATE));
        }
    }

    @Override
    public TopPanel createTopPanel() {
        return new CreditCardTopPanel();
    }

    @Override
    public OperationPanel createOperationPanel() {
        return new OperationPanel("Deposit", "Charge");
    }

    @Override
    public IController createWithdrawController() {
        return new WithdrawController("Charge");
    }

    public IController createAddCreditCardAccountController() {
        return new AddCreditCardAccountController();
    }

    public IController createGenerateMonthlyBillsController() {
        return new GenerateMonthlyBillsController();
    }

    @Override
    public AbstractTableModel createAccountTableModel() {
        return new CreditCardTableModel();
    }

    public AddCreditCardDialog createAddCreditCardAccountDialog() {
        return new creditcardapp.view.AddCreditCardDialog();
    }
}
